﻿using System;
using System.Collections.Generic;

namespace OpenLS.Spreadsheet
{
    internal class MultiColumnRegion : MultiDimensionRegion<Column>
    {
        public MultiColumnRegion(Column column1, Column column2) : base(column1, column2)
        {
        }

        protected override IEnumerable<Column> GetDimensions()
        {
            for (int i = _dim1.Index; i <= _dim2.Index; i++)
            {
                yield return _dim1.Worksheet.Columns[i];
            }
        }

        public override ClusterImpact GetClusterImpact(CellClusterKey key)
        {
            if (_dim1.Index <= key.Column)
                return ClusterImpact.Full;
            if (_dim1.Index <= key.Column - CellClusterKey.Size)
                return ClusterImpact.Partial;
            return ClusterImpact.None;
        }
    }
}